// src/router/index.js
import { createRouter, createWebHashHistory } from 'vue-router'
import { start, stop } from '@renderer/utils/nprogress'

const routes = [
  {
    path: '/',
    component: () => import('@renderer/pages/home/home.vue')
  },
  {
    path: '/list',
    component: () => import('@renderer/pages/list/list.vue')
  },
  {
    path: '/detail',
    component: () => import('@renderer/pages/list/detail.vue')
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

router.beforeEach((_to, _from, next) => {
  start()
  next()
})

// eslint-disable-next-line @typescript-eslint/no-unused-vars
router.afterEach((_to, _from) => {
  setTimeout(() => {
    stop()
  }, 150)
})

export default router